<template>
  <div class="discounts-wrap">
    <ul class="discounts-container">
      <li
        v-for="item in list"
        :key="item.id"
      >
        <div class="img-wrap">
          <img :src="item.img" alt="暂无图片" v-if="item.img"/>
          <div v-else>暂无图片</div>
        </div>
        <div class="title" :title="item.title">
          【{{item.company_name}}】{{item.title}}
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'DiscountsList',
  data() {
    return {
      list: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.$api.getCouponList({ page: this.page }).then(data => {
        this.list = data.data;
      })
    }
  }
};
</script>

<style lang="less" scoped>
  @import '../../../less/global.less';
</style>
